Royan Chusain Azhari | 19 Feb 2021 | dilihat 2
Ajax Jquery Picture
File upload functionality is a common feature for the dynamic web application. Generally, a form is submitted and page is refreshed to upload file in PHP. But if you want to provide a better user interface, jQuery and Ajax can be used to upload file without page refresh. In our earlier tutorial, we have provided an easy way to upload file using jQuery and Ajax in PHP. In this tutorial, we will show you the simplest way to upload file or image with form data using jQuery, Ajax, and PHP.
The FormData object compiles a set of key/value pairs to send using XMLHttpRequest. Basically, FormData is used to send the form data same like submit() method. The files can also be sent using FormData by including a file <input> element in the HTML <form>.
The example code shows how to submit form data and upload file using FormData object and PHP. The following functionality will be implemented in the sample Ajax file upload script.